package prolog.terms

class SystemObject extends Nonvar {
  override def name = "{'" + getClass() + "'}"

  private val ordinal = SystemObject.ctr

  override def bind_to(that: Term, trail: Trail): Boolean = {
    return super.bind_to(that, trail) && ordinal == (that.asInstanceOf[SystemObject]).ordinal
  }

  override def toString = name

  //  final override def getArity: Int = Term.JAVA

}

// Static does not exist in Scala so a companion object need to be created

object SystemObject {
  var ctr: Long = 0
  SystemObject.ctr = SystemObject.ctr + 1
}